<template>
    <div>
        <navBar title="填写报销凭证号" @onClickLeft="onClickLeft" />
        <van-cell-group>
            <van-field  class="van-field-isRequired" v-model="value" label="报销凭证号" placeholder="请输入报销凭证号" />
        </van-cell-group>
        <div class="supplement-btn">
            <van-button round block type="info" native-type="submit" @click="onSubmit">提交</van-button>
        </div>
    </div>
</template>
<script>
import navBar from "@cb/navBar.vue";
import { Field } from 'vant';
import { repUpSignature } from "@a/order.js";
import { Dialog, Toast } from "vant";
import {get} from '../../../../public/API/query'
export default {
    components: {
        navBar
    },
    data(){
        return {
            value:'',
            id:null
        }
    },
    deactivated() {
        this.$destroy(true); //销毁组件
    },
    created() {
        this.id = this.$route.query && this.$route.query.id;
    },
    methods:{
        submitPost() {
            let params = {
                rmbVoucher:this.value,
                id:this.id
            }
           get("upRmbVoucher",params, res => {
                if (res.code === 200) {
                Toast.success("请您确认信息上传");
                this.$router.push({
                    path: `/replace/details`,
                    query: {
                    id:this.id,
                    },
                });
                }
            });
        },
        onClickLeft() {
            this.$router.go(-1);
        },
        onSubmit(){
            if (this.value.trim() == "") {
                Toast.fail("请先填写报销凭证号");
                return;
            }
            this.submitPost();
        }
    }
}
</script>